<html>
	<head>
		<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> 
		<script type="text/javascript">

			$(document).ready(function(){
				$('#submit').click(function(){
					var refNum = $('#refNum').val();
					var firstName = $('#firstName').val();
					var surname = $('#surname').val();
					var age = $('#age').val();
					var phone = $('#phone').val();
					var address = $('#address1').val();
					var complaint = $('#complaint').val();
					var crossStreet = $('#crossStreet').val();
					var email = $('#email').val();

					var varData = 'refNum=' + refNum + '&email=' + email + '&firstName=' + firstName + '&surname=' + surname + '&age=' + age + '&phone=' + phone + '&address=' + address + '&complaint=' + complaint + '&crossStreet=' + crossStreet;
					console.log(varData);
					$.ajax({
						type: "POST",
						url: "http://drewx.net/Emailtest/email.php",
						data: varData,
						success: function(){
							alert("INSERT INTO request VALUES ('1','" + refNum + "',  '" + firstName + "',  '" + surname + "',  "+ age +"', '" + phone + "', '" + address + "', '" + complaint + "', '" + crossStreet + "', '" + email + "'')");
						}
					});
				});
			});

		</script>
	</head>
	<body>
		<form>
			<input type="text" name="refNum" id="refNum" />
			<label for="refNum">Reference Number</label>
			<br>
			<input type="text" name="firstName" id="firstName" />
			<label for="firstName">First Name</label>
			<br>
			<input type="text" name="surname" id="surname" />
			<label for="surname">Surname</label>
			<br>
			<input type="text" name="age" id="age" />
			<label for="age">Age</label>
			<br>
			<input type="text" name="phone" id="phone" />
			<label for="phone">Phone Number</label>
			<br>
			<input type="text" name="address1" id="address1" />
			<label for="address1">Address1</label>
			<br>
			<input type="text" name="complaint" id="complaint" />
			<label for="complaint">Health Complaint</label>
			<br>
			<input type="text" name="crossStreet" id="crossStreet" />
			<label for="crossStreet">Cross Street</label>
			<br>
			<input type="text" name="email" id="email" />
			<label for="email">Email</label>
			<br>
		</form>
		<div id="submit">Click to submit</div>
		<div id="test"><div>
	</body>
</html>